// 递归routes树中是否存在code权限
export const hasPermissionCode = (routes, code) => {
  if (routes && routes.length) {
    for (let i = 0; i < routes.length; i++) {
      let m = routes[i]
      if (m.code === code) {
        return true
      }
      if (m.children && m.children.length) {
        const childHasCode = hasPermissionCode(m.children, code)
        if (childHasCode) {
          return true
        }
      }
    }
  }
  return false
}